package com.usian.article.controller;

import com.usian.apis.article.ApArticleControllerApi;
import com.usian.article.service.ApArticleService;
import com.usian.article.service.impl.ApArticleServiceImpl;
import com.usian.model.article.pojo.ApArticle;
import com.usian.model.article.pojo.ApArticleConfig;
import com.usian.model.article.pojo.ApArticleContent;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping("/api/v1/article")
public class ApArticleController implements ApArticleControllerApi {

    @Autowired
    private ApArticleServiceImpl service;

    @Override
    @PostMapping("/saveArticle")
    public ApArticle saveArticle(@RequestBody ApArticle apArticle) {
        return service.saveArticle(apArticle);
    }

    @Override
    @PostMapping("/apArticleConfig")
    public ResponseResult saveArticleConfig(@RequestBody ApArticleConfig apArticleConfig) {
         service.saveArticleConfig(apArticleConfig);
           return service.succes;
    }

    @Override
    @PostMapping("/apArticleContent")
    public ResponseResult saveArticleContent(@RequestBody ApArticleContent apArticleContent) {
        service.saveArticleContent(apArticleContent);
        return service.succes;
    }
}
